1. Field of the Invention
The present invention relates generally to shading computer-generated images.
2. Related Art
Shading calculations in commercially available graphics systems have been limited to lighting at the vertices of a set of polygons, with the resultant colors interpolated and composited with a texture. The drawbacks of Gouraud interpolation are well known and include diffused, crawling highlights and Mach banding. See, Gouraud, H., "Computer Display of Curved Surfaces", IEEE Trans. Computers C-20 6:623-629 (1971). The use of this method is motivated primarily by the relatively large cost of the lighting computation. When done at the vertices, this cost is amortized over the interiors of polygons.
The division of a shading computation into per-vertex and per-pixel components is a general strategy in hardware graphics acceleration. See, Akeley, K., "RealityEngine Graphics", Computer Graphics (SIGGRAPH '93 Proceedings) vol. 27, J. T., Kajuya, (ed), (August 1993), pp. 109-116. Commonly, the vertex computations are performed in a general floating point processor or central processing unit (CPU), while the per-pixel computations are in special purpose, fixed point hardware. The division is a function of cost versus the general applicability, in terms of quality and speed, of a feature. Naturally, the advance of processor and application-specific integrated circuit technology has an impact on the choice.
Because the per-vertex computations are done in a general processor, the cost of a new feature tends to be dominated by additional per-pixel hardware. If this feature has a very specific application, the extra hardware is hard to justify because it lays idle in applications that do not leverage it. In low-end graphics or game systems, where every transistor counts, additional rasterization hardware is particularly expensive.
Shading quality can be increased dramatically with Phong shading, which interpolates and normalizes vertex normal vectors at each pixel. See, Phong, B.-T., "Illumination For Computer Generated Pictures", Communications of the ACM 18 6:311-317 (June 1975). Light and halfangle vectors are computed directly in world space or interpolated, either of which requires their normalization for a local viewer and light. FIG. 11A shows rasterization hardware for one example implementation of Phong shading. Phong shading adds significant cost to rasterization hardware. However, higher quality lighting is almost universally desired in three-dimensional graphics applications, and advancing semiconductor technology is making Phong shading hardware more practical.
Bump mapping is a technique used in advanced shading applications for simulating the effect of light reflecting from small perturbations across a surface. See, Blinn, J. F., "Simulation of Wrinkled Surfaces", Computer Graphics (SIGGRAPH '78 Proceedings) vol. 12, (August 1978), pp. 286-292. A single component texture map, .function.(u, v), is interpreted as a height field that perturbs the surface along its normal vector, N=(P.sub.u .times.P.sub.v)/.vertline.(P.sub.u .times.P.sub.v).vertline., at each point. Rather than actually changing the surface geometry, however, only the normal vector is modified. From the partial derivatives of the surface position in the u and v parametric directions (P.sub.u and P.sub.v) and the partial derivatives of the image height field in u and v (.function..sub.u and .function..sub.v) a perturbed normal vector N' is given by: EQU N'=((P.sub.u .times.P.sub.v)+D)/.vertline.(P.sub.u .times.P.sub.v)+D.vertline. (1)
where, a displacement vector D becomes: EQU D=--.function..sub.u (P.sub.v .times.N)--.function..sub.v (N.times.P.sub.u)(2)
In these equations, P.sub.u and P.sub.v are not normalized. This causes the bump heights to be a function of the surface scale because P.sub.u .times.P.sub.v changes at a different rate than D. If the surface scale is doubled, the bump heights are halved. This dependence on the surface often is an undesirable feature and a constant bump height is forced instead. See, Blinn, J. F., "Simulation of Wrinkled Surfaces", Computer Graphics (SIGGRAPH '78 Proceedings), vol. 12, (August 1978), pp. 286-292.
A full implementation of these equations in a rasterizer can be impractical, so the computation is divided among a preprocessing step, per-vertex, and per-pixel calculations. An expensive method to implement bump mapping in hardware, and one that is planned for a high-end graphics workstation, is to compute P.sub.u .times.P.sub.v, P.sub.v .times.N, and N.times.P.sub.u at polygon vertices and interpolate them to polygon interiors. See, Cosman, M. A. & Grange, R. L., "CIG Scene Realism: The World Tomorrow", Proceedings of I/ITSEC 1996 on CD-ROM, (1996), p. 628. The perturbed normal vector is computed and normalized as in Equation 1, with .function..sub.u and .function..sub.v read from a texture map. The resulting normal vector is used in an illumination model.
The hardware for this method of Cosman and Grange is shown in FIG. 11B. Because P.sub.u and P.sub.v are unbounded, the three interpolators and the vector addition, vector scaling, and normalization units must have much greater range and precision than those needed for bounded vectors. One approximation to this expensive implementation has been proposed, where P.sub.v .times.N and N.times.P.sub.u are held constant across a polygon. See, Ernst, I., et al., "Hardware Supported Bump Mapping: A Step Towards Higher Quality Real-Time Rendering", 10th Eurographics Workshop on Graphics Hardware (1995), pp. 63-70. This approximation is known to have artifacts.